package com.umeox.moto.watch.themes.util;

import android.annotation.SuppressLint;
import android.content.Context;
import android.net.wifi.WifiManager;
import android.telephony.TelephonyManager;

import java.util.List;

public class CommonUtils {

    public static final String FLAVOR_SGP = "K11_SGP";
    public static final String FLAVOR_JAPAN = "K11_Japan";
    public static final String FLAVOR_KIDSLINK = "K11_Kidslink";
    public static final String FLAVOR_ELARI = "K11_Elari";
    public static final String FLAVOR_MYALO = "K11_Myalo";
    public static final String FLAVOR_WATCH_OUT = "K11_WatchOut";
    public static final String FLAVOR_MIMO = "Mimo";
    public static final String FLAVOR_MIMO_PHONE = "Mimo_Phone";
    public static final String FLAVOR_TW = "K11_Taiwan";
    public static final String FLAVOR_S12_ELARI = "S12_Elari";

    /**
     * @param <V>
     * @param sourceList
     * @return if list is null or its size is 0, return true, else return false.
     */
    public static <V> boolean isEmpty(List<V> sourceList) {
        return (sourceList == null || sourceList.size() == 0);
    }

    public static void setWifiState(Context context, boolean enable) {

        WifiManager wifiManager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
        if (wifiManager != null) {
            wifiManager.setWifiEnabled(enable);
        }
    }

    public static boolean getWifiState(Context context) {
        WifiManager wifiManager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
        if (wifiManager != null) {
            return wifiManager.isWifiEnabled();
        }
        return false;
    }

    @SuppressLint({"MissingPermission", "HardwareIds"})
    public static String getDeviceId(Context context) {
        TelephonyManager tm = (TelephonyManager) context
                .getSystemService(Context.TELEPHONY_SERVICE);
        return tm.getDeviceId();
    }


}
